package com.estate.service.building;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.estate.mapper.BanMapper;
import com.estate.pojo.Ban;

@Service
public class BuildingServiceImpl implements BuildingService {
	
	@Autowired
	private BanMapper banMapper;
	
	@Override
	public Boolean addBuilding(Ban ban) {
		try {
			int num = banMapper.insert(ban);
			if(num <=0){
				return false;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return true;
	}

	@Override
	public List<Ban> selectBanByProId(Integer ProId) {
		List<Ban> banlist = new ArrayList<>();
		try {
			banlist = banMapper.selectBanByProId(ProId);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return banlist;
	}

	@Override
	public List<Ban> selectBanByRegionId(Integer regionId) {
		List<Ban> banlistByRegionId = new ArrayList<>();
		try {
			banlistByRegionId = banMapper.selectBanByRegionId(regionId);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return banlistByRegionId;
	}
	
}
